Parent Topic: Resampling Example

Cubic Convolution
Resampling kernel (k) has the dimensions of 4 pixels by 4 scanlines.

     -1   0   1   2
    +---+---+---+---+
 -1 |   |   |   |   |
    +---+---+---+---+
  0 |   | X |   |   |
    +---+---+---+---+
  1 |   |   |   |   |
    +---+---+---+---+
  2 |   |   |   |   |
    +---+---+---+---+
Process for the resample window:

  row[-1] = CubicConvolution(Xdistance,k[-1,-1],k[-1,0],k[-1,1],k[-1,2])
  row[ 0] = CubicConvolution(Xdistance,k[ 0,-1],k[ 0,0],k[ 0,1],k[ 0,2])
  row[ 1] = CubicConvolution(Xdistance,k[ 1,-1],k[ 1,0],k[ 1,1],k[ 1,2])
  row[ 2] = CubicConvolution(Xdistance,k[ 2,-1],k[ 2,0],k[ 2,1],k[ 2,2])
  output  = CubicConvolution(Ydistance,row[-1],row[ 0],row[ 1],row[ 2])
Where the resampling function is:

CubicConvolution( distance, f0, f1, f2, f3 ) 
{
  return(  (   -f0 +     f1 - f2 + f3) * distance**3
         + (2.0*f0 - 2.0*f1 + f2 - f3) * distance**2
         + (   -f0          + f2     ) * distance**1
         +               f1                         );
}
NOTE: A distance of 0.0 would zero the distance**3, distance**2 and distance**1 terms, in which case f1 would be returned as is.


Parent Topic: Resampling Example
About PCI Help Gateway